package pl.wroc.uni.ii.pastuszka.algorithms.evolutionary.utils;

import java.util.Random;

public class BinaryRandom {
  private static Random generator = new Random();
  private static final float uniformProbability = 0.5f;

  public static int getInt(float probabilityOfOne) {
    return generator.nextFloat() < probabilityOfOne ? 1 : 0;
  }

  public static int getInt() {
    return generator.nextFloat() < uniformProbability ? 1 : 0;
  }

  public static boolean getBoolean(float probabilityOfTrue) {
    return generator.nextFloat() < probabilityOfTrue;
  }

  public static boolean getBoolean() {
    return generator.nextBoolean();
  }
}
